package com.bright.hxj.cwduijie;

import com.bright.ghj.common.util.StringUtil;
import com.bright.hxj.cwduijie.util.EntityManagerUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@SpringBootApplication(scanBasePackages = {"com.bright.ghj.common", "com.bright.hxj.cwduijie"})
//@EnableCaching
@EnableScheduling
@EnableTransactionManagement
public class CwduijieApplication extends SpringBootServletInitializer/* implements CommandLineRunner*/ {

    public static void main(String[] args) {
        SpringApplication.run(CwduijieApplication.class, args);
    }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(CwduijieApplication.class);
    }

    /*
     * 获取当前连接数据库的类型 默认是SQLServer
     */
//    @Value("${database.type:sqlserver}")
//    public String dataBaseType;
//
//    @Override
//    public void run(String... args) throws Exception {
//        // 初始化参数赋值
//        System.out.println("初始加载时使用dataBaseType=" + dataBaseType);
//
//        if (StringUtil.equalsIgnoreCase(dataBaseType, "dm")) {
//            EntityManagerUtil.IS_DM = true;
//        }
//    }
}